<?php defined('SYSPATH') OR die('No direct access allowed.');
foreach($posts as $post): ?>
<!-- BEGIN POST ITEM -->
  <li class='post rounded'>
    <dl>
      <dt>
				<span class="title"><?=html::anchor(Router::uri('forum', array('controller'=>'post', 'method'=>$post->id)), $post->title)?></span>
				<span class="manage">
					<? if (access::can($post, 'update')):?>
					<form action='/<?=Router::uri('forum', array('controller'=>'post', 'method'=>'edit'))?>' method='POST'>
						<?=form::hidden('id', $post->id)?>
						<input type='submit' value='edit' />
					</form>
					<? endif; ?>
					<? if (access::can($post, 'delete')):?>
					<form action='/<?=Router::uri('forum', array('controller'=>'post', 'method'=>'delete'))?>' method='POST'>
						<?=form::hidden('id', $post->id)?>
						<input type='submit' value='delete' />
					</form>
					<? endif; ?>
				</span>
			</dt>
      <dd class="description">
				<span><?=Kohana::lang('post.author')?>: <?=html::anchor(Router::uri('auth', array('method'=>'profile', 'id'=>$post->author->id)),$post->author->username, array('class'=>'service_link'))?></span>
				<span><?=Kohana::lang('post.started')?>: [<?=cmsformat::timestamp('forum.post', $post->created)?>]</span>
				<span><?=Kohana::lang('post.comment_count')?>: <?=html::anchor(Router::uri('forum', array('controller'=>'post', 'method'=>$post->id)).($post->comment_count>Kohana::config('forum.comments_per_page') ? "?page=".ceil((int)$post->comment_count/(int)Kohana::config('forum.comments_per_page')) : ""), $post->comment_count, array('title'=>Kohana::lang('forum.goto_last_comment')))?></span>
			</dd>
    </dl>
		<? Event::run('forum.post.list', $post);?>
  </li>
<!-- END POST ITEM -->
<? endforeach;?>